﻿<%@ Page Title="" Language="C#" MasterPageFile="~/YUIAspNet.Master" AutoEventWireup="true" CodeBehind="Popup.aspx.cs" Inherits="YUIAspNetDemo.Calendar.Popup" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>YUIAsp.Net Controls : LiveDemo : Calendar : Pop-up calendar</title>
    <script type="text/javascript">

        function ToggleCalendar() {
            $find('<%= calendar.ClientID %>').Toggle();
        }

        function DateSelected(sender, args) {
            $get('<%= tbDate.ClientID %>').value = (args.date.getMonth() + 1) + "/" + args.date.getDate() + "/" + args.date.getFullYear();
            sender.Toggle();
        }
    </script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h1>Pop-up calendar</h1>
    
    <p>A simple calendar real-life example. Select the date, and the calendar will hide, and you'll have the date populated into the textbox</p>
    
    <p>
        <asp:TextBox ID="tbDate" Enabled="false" runat="server"></asp:TextBox><asp:Button ID="calShow" runat="server" Text="..." OnClientClick="ToggleCalendar(); return false;" />
        <yui:Calendar ID="calendar" VisibleOnLoad="false" runat="server" ShowClose="true" OnClientSelect="DateSelected" />
    </p>
</asp:Content>
